<?php

class ProjectsController extends ProjectController
{


	public function actionCreate(){
		$data = array();
		if(!empty($_POST)){
			try{
				$project = Projects::model()->create();
				if($project):
					$d = array();
					$projects = Projects::model()->getProject();
					if(!empty($projects)){
						$projects->id = outStr($projects->id);
						$projects->user_id = outStr($projects->user_id);
						$d = $projects->attributes;
					}else{
					
					}
					$data = array(
						'code'=>'200',
						'data'=>$d,
						'message'=>_t('Created an project successfully.')
					);
				else:
					$data = array(
						'code'=>'404',
						'message'=>_t('Created an project fail.')
					);
				endif;
			}catch(Exception $e){
				$data = array(
					'code'=>'404',
					'message'=>$e->getMessage()
				);
			}
		}else{
			$data = array(
				'code'=>'404',
				'message'=>_t('Request bad')
			);
		}
		jsonOut($data);
	}
	
	
	
	
}
